<template>
	<q-tabs shrink @input="selected">
		<q-tab :name="item.id" :label="item.label" v-for="(item,index) in data" :key="index" />
	</q-tabs>
</template>
<script>
	export default {
		name: 'ASiteNavbar',
		props: {
			data: {
				type: Array,
				default: ()=>[]
			}
		},
		data(){
			return {
				tab:''
			}
		},
		computed:{
			currTab(){
				for (let item of this.data){
					if(item.id === this.tab){
						return item;
					}
				}
				return {}
			}
		},
		methods:{
			selected(name){
				this.tab = name;
				this.$emit('tabSelected', this.currTab);
			}
		}
	};
</script>
